﻿var data2 = { RSSURL: 'http://mvccms.codeplex.com/Project/ProjectRss.aspx' }
var encoded2 = JSON.stringify(data2);
var now2 = new Date();
$.post(
    "/mvccmsAjax/RSSReader/" + now2.getMilliseconds(),
    { data: encoded2 },
    function (data) {
	    if (data.error){
	        //alert(data.error);
	    }
	    else {
	        PopulateRSS(data);
	    }
    },
    "json"
); 

function PopulateRSS(rssitems){
    var tblRow = "";
    $.each(rssitems, function(i, item) {
        if (i < 11) {
            tblRow += "<tr>";
            tblRow += "<td class='rsslink'><a href='" + item.Link + "'>" + item.Title + "</a> " + item.ElapsedTime + " ago</td>";
            tblRow += "</tr>";
            $(tblRow).appendTo("#MvcCmsRssList tbody");
            tblRow = "";
        }
    });
}
